package com.sx.zongzhi.adapter;


import android.content.Context;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.sx.zongzhi.R;
import com.sx.zongzhi.bean.AppealProcessBean;
import com.zhy.adapter.abslistview.CommonAdapter;
import com.zhy.adapter.abslistview.ViewHolder;

import java.util.List;

/**
 * Created by XZY on 2017/11/23.
 * 诉求服务办理过程
 */
public class AppealProAdapter extends CommonAdapter<AppealProcessBean> {


    private Context context;

    public AppealProAdapter(Context context, int layoutId, List<AppealProcessBean> datas) {
        super(context, layoutId, datas);
        this.context=context;
    }



    @Override
    protected void convert(ViewHolder viewHolder, AppealProcessBean item, int position) {
        ImageView imageView=viewHolder.getView(R.id.imv_Hint);
        if (position==0){
            imageView.setImageResource(R.mipmap.icon_process_selected);
        }else {
            imageView.setImageResource(R.mipmap.icon_process_normal);
        }
        viewHolder.setText(R.id.tv_Time,item.getHandleTime());
        viewHolder.setText(R.id.tv_Title,"【"+item.getHandleOrgName()+"】"+item.getHandleUserName()+" "+item.getOperation());
        viewHolder.setText(R.id.tv_Content,"并留言："+item.getDescription());
        RecyclerView view = viewHolder.getView(R.id.recyclerView);
        if (item.getFiles() != null && item.getFiles() .size() > 0) {
            view.setLayoutManager(new LinearLayoutManager(context, LinearLayout.HORIZONTAL, false));
            PictureAdapter pictureAdapter = new PictureAdapter(context, item.getFiles());
            view.setAdapter(pictureAdapter);
//            pictureAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
//                @Override
//                public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
//                    context.startActivity(new Intent(context,PatrolLogDetailActivity.class).putExtra("PatrolLog",item));
//                }
//            });

        }
    }
}
